#pragma once

#include <afx.h>
#include <afxwin.h>
#include <afxinet.h>
#include <iostream>
#include "afxtempl.h"
#include "afxwin.h"

class CAllTabs;

UINT MyThreadProc( LPVOID pParam );

class CHttpGet 
{
public:
	CHttpGet();           // protected constructor used by dynamic creation

	CHttpGet(CAllTabs* allTabs, int mode, CPrefTab *prefs);
	virtual ~CHttpGet(void);
	bool downloadFile(LPCTSTR pszURL, LPCTSTR fileName);

	CInternetSession *session;
	CHttpConnection *httpConnection;
	void Download(void);

	CList<CHttpFile*, CHttpFile*> _xmlList;
	CList<CFile*, CFile*> _fileXmlList;

	CString getFileName(void);
	CAllTabs* _allTabs;
	bool addRequest(LPCTSTR pszURL, LPCTSTR fileName);
	bool isEmpty(void);
	bool cutHead(void);
	bool _isStarted;
	bool _requested;
	int _mode;
	int _stop;
	CPrefTab* _prefs;
	int killThread(void);
};
